package com.xiyuan.smartutils.template.engine.expression.primitive;

import com.xiyuan.smartutils.template.engine.VariableMap;
import com.xiyuan.smartutils.template.engine.exception.ExpressionException;

/**
 * 字符原型，格式为用单引号之内的一个字母或符号，如'a','$'
 * 
 * @version v1.0.0 @author lgz 2020年11月1日 新建与整理
 */
public class _Char extends Primitive
{
    private static final long serialVersionUID = 1L;
    private char value;
    
    public _Char(String path,int line, int column, char value)
    {
        super(path, line, column);
        this.value = value;
        
    }
    
    @Override
    public int getType()
    {
        return CHAR;
    }
    
    @Override
    public Object build(VariableMap variableMap) throws ExpressionException
    {
        return value;
    }
    
    @Override
    public String toString()
    {
        return "'"+value+"'";
    }
    
    public char getValue()
    {
        return value;
    }
}
